package com.book.mapper;

import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.book.entity.Cart;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Repository
public interface CartMapper extends BaseMapper<Cart> {

    //todo
    int queryCount(Map<String, Object> params);

    //todo
    List<Cart> query(Map<String, Object> params);

    //todo
    @Select(" SELECT COUNT(*) AS `count`,SUM(CAST(total_price AS DECIMAL(9,1))*COUNT) AS totalmoney  FROM cart c WHERE c.uid=#{username};")
    Map<String, Object> statistics(@Param("username") String username);
}
